package com.acpt.entity;



import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Collection;
import java.util.Set;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

public class LoginUser implements UserDetails {
  private static final long serialVersionUID = 1L;
  private Long userId;
  private Long deptId;
  private String token;
  private Long loginTime;
  private Long expireTime;
  private String ipaddr;
  private String loginLocation;
  private String browser;
  private String os;
  private Set<String> permissions;
  private Set<String> roles;
  private User user;

  public Long getUserId() {
    return this.userId;
  }

  public void setUserId(Long userId) {
    this.userId = userId;
  }

  public Long getDeptId() {
    return this.deptId;
  }

  public void setDeptId(Long deptId) {
    this.deptId = deptId;
  }

  public String getToken() {
    return this.token;
  }

  public void setToken(String token) {
    this.token = token;
  }

  public LoginUser() {
  }

  public LoginUser(User user, Set<String> permissions) {
    this.user = user;
    this.permissions = permissions;
  }

  public LoginUser(Long userId, Long deptId, User user, Set<String> permissions, Set<String> roles) {
    this.userId = userId;
    this.deptId = deptId;
    this.user = user;
    this.permissions = permissions;
    this.roles = roles;
  }

  @Override
  @JSONField(
      serialize = false
  )
  @JsonIgnore
  public String getPassword() {
    return this.user.getPassword();
  }

  @Override
  @JsonIgnore
  public String getUsername() {
    return this.user.getUserName();
  }

  @Override
  @JSONField(
      serialize = false
  )
  @JsonIgnore
  public boolean isAccountNonExpired() {
    return true;
  }

  @Override
  @JSONField(
      serialize = false
  )
  @JsonIgnore
  public boolean isAccountNonLocked() {
    return true;
  }

  @Override
  @JSONField(
      serialize = false
  )
  @JsonIgnore
  public boolean isCredentialsNonExpired() {
    return true;
  }

  @Override
  @JSONField(
      serialize = false
  )
  @JsonIgnore
  public boolean isEnabled() {
    return true;
  }

  public Long getLoginTime() {
    return this.loginTime;
  }

  public void setLoginTime(Long loginTime) {
    this.loginTime = loginTime;
  }

  public String getIpaddr() {
    return this.ipaddr;
  }

  public void setIpaddr(String ipaddr) {
    this.ipaddr = ipaddr;
  }

  public String getLoginLocation() {
    return this.loginLocation;
  }

  public void setLoginLocation(String loginLocation) {
    this.loginLocation = loginLocation;
  }

  public String getBrowser() {
    return this.browser;
  }

  public void setBrowser(String browser) {
    this.browser = browser;
  }

  public String getOs() {
    return this.os;
  }

  public void setOs(String os) {
    this.os = os;
  }

  public Long getExpireTime() {
    return this.expireTime;
  }

  public void setExpireTime(Long expireTime) {
    this.expireTime = expireTime;
  }

  public Set<String> getPermissions() {
    return this.permissions;
  }

  public Set<String> getRoles() {
    return this.roles;
  }

  public void setPermissions(Set<String> permissions) {
    this.permissions = permissions;
  }

  public void setRoles(Set<String> roles) {
    this.roles = roles;
  }

  public User getUser() {
    return this.user;
  }

  public void setUser(User user) {
    this.user = user;
  }

  public Collection<? extends GrantedAuthority> getAuthorities() {
    return null;
  }
}


